<template>
  <div>
    <div class="text_body">
      <h1>{{title}}</h1>
      <br />
      <span>作者：{{name}}</span>
      <span>时间：{{create_time}}</span>
      <div v-html="text" class="news_content"></div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      text: null,
      title: null,
      name: null,
      create_time: null
    };
  },
  components: {},
  watch: {
    $route: {
      handler: function(val, oldVal) {
        this.upData(this.$route.query.id);
      },
      deep: true
    }
  },
  created: function() {
    this.upData(this.$route.query.id)
  },
  methods: {
    upData(n){
      var d = { id:  n};
      this.$api.strategyAPI.get_strategy(d).then(res => {
      this.text = res.data.data.text;
      this.title = res.data.data.title;
      this.name = res.data.data.name;
      this.create_time = res.data.data.create_time;
    });
    }
  }
};
</script>

<style lang="scss" scoped>
.text_body {
  padding-top: 50px;
  width: 800px;
  margin: auto;
  
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.news_content {
  margin-top: 10px;
  p {
    margin: 20px 0 20px 0;
  }
}
</style>